//
//  TelePhoneModels.swift
//  zhonglb_iOS
//
//  Created by lxm on 2021/12/9.
//

import Foundation
import HandyJSON
import UIKit

class TelePhoneModels {
    struct PhoneInfo : HandyJSON {
        var city = ""
        var company = ""
        var phone = ""
        var province = ""
        var type = ""
    }
    
    // 话费充值项
    struct MealInfo : HandyJSON {
        var id = 0
        // 售价
        var sellPrice = 0.0
        // 类型：0慢充 1快充
        var type = 0
        // 充值面额
        var faceValue = 0.0
    }
    
    // 话费充值参数信息
    struct ConfigInfo : HandyJSON {
        //消耗的贡献值
        var consumeContribution = ""
        // 金额与助农券的换算比例%（1助农券 = conversion人民币）
        var conversion = 0.0
        // 月次数
        var monthlyNum = ""
        // 服务费比例%
        var serviceChargeRatio = 0.0
        // 本月剩余次数
        var surplusNum = 0
        // 爱心值比例
        var loveRatio : Double = 5
    }
    
    struct Record : HandyJSON {
        var commission = 0.0
        var createTime = ""
        var facePrice = 0.0
        var id: Int = 0
        var isDel: Bool = false
        var isSystemDel: Bool = false
        var mark = ""
        var orderId = ""
        var outTradeNo = ""
        var paid: Bool = false
        var payPrice = 0.0
        var payTime = ""
        var payType = ""
        var phone = ""
        var refundPrice: Int = 0
        var refundReason = ""
        var refundReasonTime = ""
        var refundReasonWap = ""
        var refundReasonWapExplain = ""
        var refundReasonWapImg = ""
        var refundStatus: Int = 0
        var settleTime = ""
        var status: Int = 0
        var title = ""
        var type: Int = 0
        var uid: Int = 0
        
        var typStr : String {
            get {
                if type == 0 {
                    return "慢充"
                } else {
                    return "快充"
                }
            }
        }
        
        func statusDes() -> (title : String, color : UIColor) {
            if status == 0 {
                return (title : "充值中", color : UIColor.zm.color333333())
            } else if status == 1 {
                return (title : "已完成", color : UIColor.zm.color333333())
            } else if status == 2 {
                return (title : "充值失败", color : Style.mainColor)
            } else if status == 3 {
                return (title : "已失效", color : UIColor.zm.color333333())
            }
            return (title : "已完成", color : Style.mainColor)
        }
    }
    
//    enum RechargeState : String, HandyJSONEnum {
//        case success = "1"
//        case charging = "0"
//        case failed = "9"
//
//        func des() -> String {
//            switch self {
//            case .success:
//                return "充值成功"
//            case .charging:
//                return "充值中"
//            case .failed:
//                return "充值失败"
//            }
//        }
//
//        func titleColor() -> UIColor {
//            switch self {
//            case .success:
//                return Style.mainColor
//            case .charging:
//                return UIColor.zm.color333333()
//            case .failed:
//                return UIColor.red
//            }
//        }
//    }
}
